#ifndef _MPxDrawOverride
#define _MPxDrawOverride
//-
// ==========================================================================
// Copyright (C) 2010 Autodesk, Inc., and/or its licensors.  All rights
// reserved.
//
// The coded instructions, statements, computer programs, and/or related
// material (collectively the "Data") in these files contain unpublished
// information proprietary to Autodesk, Inc. ("Autodesk") and/or its
// licensors,  which is protected by U.S. and Canadian federal copyright law
// and by international treaties.
//
// The Data may not be disclosed or distributed to third parties or be
// copied or duplicated, in whole or in part, without the prior written
// consent of Autodesk.
//
// The copyright notices in the Software and this entire statement,
// including the above license grant, this restriction and the following
// disclaimer, must be included in all copies of the Software, in whole
// or in part, and all derivative works of the Software, unless such copies
// or derivative works are solely in the form of machine-executable object
// code generated by a source language processor.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
// AUTODESK DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED
// WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF
// NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE,
// OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE. IN NO
// EVENT WILL AUTODESK AND/OR ITS LICENSORS BE LIABLE FOR ANY LOST
// REVENUES, DATA, OR PROFITS, OR SPECIAL, DIRECT, INDIRECT, OR
// CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS LICENSORS HAS
// BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES.
// ==========================================================================
//+
//
// CLASS:    MPxDrawOverride
//
// ****************************************************************************
//
// CLASS DESCRIPTION (MPxDrawOverride)
//
//  MPxDrawOverride allows the user to define custom draw code to be
//  used to draw all instances of a specific DAG object type in Maya when using
//  Viewport 2.0.
//
// ****************************************************************************

#if defined __cplusplus

// ****************************************************************************
// INCLUDED HEADER FILES

#include <maya/MBoundingBox.h>
#include <maya/MMatrix.h>
#include <maya/MUserData.h>

// ****************************************************************************
// DECLARATIONS

class MObject;
class MDagPath;

// ****************************************************************************
// NAMESPACE

namespace MHWRender
{

class MDrawContext;

// ****************************************************************************
// CLASS DECLARATION (MPxDrawOverride)

//! \ingroup OpenMayaRender MPx
//! \brief Base class for user defined drawing of nodes.
/*!
MPxDrawOverride allows the user to define custom draw code to be used
to draw all instances of a specific DAG object type in Maya when using
Viewport 2.0.

transform() should always return the world space transformation matrix for the
object to be drawn in the custom draw code. The default implementation simply
returns the transformation defined by the parent transform nodes.

boundingBox() should always return the object space bounding box for whatever
is to be drawn in the custom draw code. If the bounding box is incorrect the
node may be culled at the wrong time and the custom draw method might not be
called.

For each refresh, prepareForDraw() is called which allows the user to pull data
from Maya to be used in the draw phase. It is invalid to query attribute values
from Maya nodes during the draw callback and doing so may result in
instability.

At draw time, the user defined callback will be invoked at which point any
custom OpenGL drawing may occur. Data needed from the Maya dependency graph
must have been cached in the prepareForDraw() stage as it is invalid to query
such data during the draw callback.

Implementations of MPxDrawOverride must be registered with Maya through
MDrawRegistry.
*/
class OPENMAYARENDER_EXPORT MPxDrawOverride
{
public:
	//! User draw callback definition, draw context and blind user data are parameters
	typedef void (*GeometryDrawOverrideCb)(const MDrawContext&, const MUserData*);

	MPxDrawOverride(
		const MObject& obj,
		GeometryDrawOverrideCb callback);

	virtual ~MPxDrawOverride();

	virtual MMatrix transform(
		const MDagPath& objPath,
		const MDagPath& cameraPath) const;

	virtual MBoundingBox boundingBox(
		const MDagPath& objPath,
		const MDagPath& cameraPath) const = 0;

	virtual MUserData* prepareForDraw(
		const MDagPath& objPath,
		const MDagPath& cameraPath,
		MUserData* oldData) = 0;

	static	const char*	className();

private:
	GeometryDrawOverrideCb fCallback;

};

} // namespace MHWRender

#endif /* __cplusplus */
#endif /* _MPxDrawOverride */
